package thread.test5SyncCollections;

import net.sf.ehcache.util.concurrent.ConcurrentHashMap;
import org.junit.Test;

import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 */
public class SyncCollectionsTest {


    /**
     */
    @Test
    public void test1(){
        ArrayList<String> list1=new ArrayList<>();
        List list2= Collections.synchronizedList(list1);
    }


    /**
     */
    @Test
    public void test2(){
        //System.out.println(sun.misc.Hashing.stringHash32("abc"));
        System.out.println("abc".hashCode());
        Map map=new HashMap<>();
        map.put(1L,"ddd");
        System.out.println(map.get(1));
    }


    /**
     * ConcurrentHashMap 线程安全，用来代替同步map
     * 如 HashTable(线程安全)，
     * Collections.synchronizedMap(map)
     */
    @Test
    public void test3(){

    }


    /**
     * CopyOnWriteArrayList  list
     */
    @Test
    public void test33(){
    }

    /**
     * CopyOnWriteArraySet   Set
     */
    @Test
    public void test4(){

    }

    /**
     * ConcurrentLinkedQueue(非阻塞队列，线程安全)
     */
    @Test
    public void test5(){

    }

    /**
     * treeMap
     * ConcurrentSkipListMap 用来代替 sortMap
     * SoredMap Collections.synchronzedMap TreeMap
     */
    @Test
    public void test6(){

    }

    /**
     * treeSet
     * ConcurrentSkipListSet   用来代替sortSet
     * SoredSet    Collections.synchronzedSet   TreeSet
     */
    @Test
    public void test7(){

    }


    @Test
    public void test(){

    }
}
